package cn.jtcoding.order.service.impl.feign.fallback;

import cn.jtcoding.common.framework.vo.ApiResult;
import cn.jtcoding.order.service.impl.feign.UserAddressFeignService;
import cn.jtcoding.user.pojo.bo.UserAddressBO;
import cn.jtcoding.user.pojo.dataobject.UserAddressDO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

@Component
public class UserAddressFeignFallbackFactory implements FallbackFactory<UserAddressFeignService> {
    @Override
    public UserAddressFeignService create(Throwable cause) {
        return new UserAddressFeignService() {
            @Override
            public ApiResult<List<UserAddressBO>> listUserAddress(String userId) {
                return ApiResult.success(Collections.emptyList());
            }

            @Override
            public void addUserAddress(UserAddressBO userAddressBO) {
            }

            @Override
            public void updateUserAddress(UserAddressBO userAddressBO) {
            }

            @Override
            public void deleteUserAddress(String userId, String addressId) {
            }

            @Override
            public void updateUserAddressToBeDefault(String userId, String addressId) {
            }

            @Override
            public ApiResult<UserAddressDO> queryUserAddress(String userId, String addressId) {
                return ApiResult.success();
            }
        };
    }
}
